package com.ubank.accountquery;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import com.ubank.GlobalInfo;
import com.ubank.R;
import com.ubank.bean.CurrentDepositCard;
import com.ubank.utils.PublicUtil2;
import com.ubank.utils.PublicUtils;
import com.ubank.utils.QueryUtils;

public class AccountBalance1 extends Activity {

	TextView account_num;
	TextView account_type;
	TextView currency;
	TextView account_sum;
	TextView interet_rate;
	TextView title;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		setContentView(R.layout.account_balance1);

		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
				R.layout.baseactivity);
		account_num = (TextView) findViewById(R.id.account_balance1_account_num);
		account_type = (TextView) findViewById(R.id.account_balance1_account_type);
		currency = (TextView) findViewById(R.id.account_balance1_currency);
		account_sum = (TextView) findViewById(R.id.account_balance1_count);
		interet_rate = (TextView) findViewById(R.id.account_balance1_interest_rate);
		account_num.setText(getIntent().getCharSequenceExtra("account_num"));
		account_type.setText(getIntent().getCharSequenceExtra("account_type"));
		title = (TextView) findViewById(R.id.account_balance1_title);
		PublicUtil2 _util = new PublicUtil2();
		_util.navigate(title, this, true);
		Button return_btn_baseactivity = (Button) findViewById(R.id.return_btn_baseactivity);
		return_btn_baseactivity.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
		initData();
	}
	
	public void initData() {
		GlobalInfo globalInfo=(GlobalInfo)getApplication();

		CurrentDepositCard data=QueryUtils.getAccountInfo1(globalInfo.getCurrentAccountNum());
		account_num.setText(globalInfo.getCurrentAccountNum());
		account_type.setText(globalInfo.getCurrentAccountType());
		currency.setText(data.getCurrency());
		account_sum.setText(data.getBalance()+"");
		interet_rate.setText(data.getRate()*100+"%");

	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{
		PublicUtils.createMenus(menu);
		PublicUtils.setMenuBackground(this);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item)
	{
		PublicUtils.onMenuItemSelected(this, item);
		return super.onOptionsItemSelected(item);
	}

}
